/*package com.hy.mydesktop.client.component.factory;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.extjs.gxt.ui.client.data.BaseModel;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.Container;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Window;
import com.google.gwt.dev.util.collect.HashMap;
import com.hy.mydesktop.client.component.factory.ButtonFactory;
import com.hy.mydesktop.client.component.meta.GxtComponentMetaModel;
import com.hy.mydesktop.client.component.meta.GxtMetaModelTypeEnum;
import com.hy.mydesktop.client.component.type.ComponentTypeEnum;
import com.hy.mydesktop.shared.persistence.domain.gxt.GxtComponentMetaNodeModel;

*//**
 * 
 * <ul>
 * <li>�������ߣ�������</li>
 * <li>������ڣ�2010-8-27��ʱ�䣺����11:52:08</li>
 * <li>������ƣ�GxtComponentFactory</li>
 * <li>���Ŀ�ģ�</li>
 * </ul>
 * <ul>
 * <b>�޶���ţ�</b>
 * <li>�޶����ڣ�</li>
 * <li>�޶����ߣ�</li>
 * <li>�޶�ԭ��</li>
 * <li>�޶����ݣ�</li>
 * </ul>
 *//*
public  class GxtComponentFactory2 {
	
	*//**
	 * 
	 * <ul>
	 * <li>�������壺</li>
	 * <li>�������ߣ�������</li>
	 * <li>��д���ڣ�2010-8-28��ʱ�䣺��������10:56:34</li>
	 * </ul>
	 * <ul>
	 * <b>�޶���ţ�</b>
	 * <li>�޶����ڣ�</li>
	 * <li>�޶����ߣ�</li>
	 * <li>�޶�ԭ��</li>
	 * <li>�޶����ݣ�</li>
	 * </ul>
	 * @param <COMPONENT>
	 * @param gxtComponentMetaModel
	 * @return
	 *//*
	public static <COMPONENT extends Component> COMPONENT createGxtComponent(
			GxtComponentMetaModel gxtComponentMetaModel) {
		
		
		COMPONENT component = null;
		GxtMetaModelTypeEnum gxtMetaModelTypeEnum = gxtComponentMetaModel.getGxtMetaModelTypeEnum();
		switch (gxtMetaModelTypeEnum) {
			case BASE_GXT_META_MODEL_TYPE:
				
				return createBaseGxtComponent(gxtComponentMetaModel);
				
			case TREE_GXT_META_MODEL_TYPE:
				
				return component;
			default:
				return null;
		}
	}
	*//**
	 * ���GxtComponentMetaModel(�̳�BaseModel)��������һ�ؼ�
	 * @param <COMPONENT>
	 * @param gxtComponentMetaModel
	 * @return
	 *//*
	private static <COMPONENT extends Component> COMPONENT createBaseGxtComponent(
			GxtComponentMetaModel gxtComponentMetaModel) {
		//BaseModel gxtComponentMetaModel=null;
		
		COMPONENT component = null;
		
		
		ComponentTypeEnum componentTypeEnum = gxtComponentMetaModel.getComponentTypeEnum();
		
		switch (componentTypeEnum) {
		//��һö�ٳ�ComponentTypeEnum�����еĿؼ�����
		case BUTTON_MODEL: {
			component = (COMPONENT) ButtonFactory.createButton(gxtComponentMetaModel);
		}
		case GRID_MODEL: {
			component = (COMPONENT) GridFactory.createGrid(gxtComponentMetaModel);
		}
		//����Ķ�������е�
		case WINDOW_MODEL: {
			component = (COMPONENT) WindowFactory.buildButton(gxtComponentMetaModel);
		}
		case TOOLBAR_MODEL: {
			component = (COMPONENT) ButtonFactory.buildButton(gxtComponentMetaModel);
		}
		
		
		case CHART_MODEL: {
			component = (COMPONENT) ButtonFactory.buildButton(gxtComponentMetaModel);
		}
		case TREE_MODEL: {
			component = (COMPONENT) ButtonFactory.buildButton(gxtComponentMetaModel);
		}
		
		default: {//��componentTypeEnumΪ�գ����������пؼ����Ͳ����ʱ
			component = null;
			break;
		}
		}
		return component;
	}
	
	*//**
	 * 
	 * <ul>
	 * <li>�������壺�����������νṹ�Ŀؼ���GxtComponentMetaModelΪ���νṹ��</li>
	 * <li>�������ߣ�������</li>
	 * <li>��д���ڣ�2010-8-28��ʱ�䣺��������10:53:22</li>
	 * </ul>
	 * <ul>
	 * <b>�޶���ţ�</b>
	 * <li>�޶����ڣ�</li>
	 * <li>�޶����ߣ�</li>
	 * <li>�޶�ԭ��</li>
	 * <li>�޶����ݣ�</li>
	 * </ul>
	 * @param <COMPONENT>
	 * @param gxtComponentMetaModelList
	 * @return
	 *//*
	private static <COMPONENT extends Component> COMPONENT createTreeGxtComponent(
			GxtComponentMetaModel gxtComponentMetaModel) {
		//�ؼ���������У������α���
		//��һ�Σ���������
	
		//Map<GxtComponentMetaModel, COMPONENT> map = new HashMap<GxtComponentMetaModel, COMPONENT>();
		if(gxtComponentMetaModel.getGxtMetaModelTypeEnum()!=GxtMetaModelTypeEnum.TREE_GXT_META_MODEL_TYPE){
			return null;
		}
		*//**
		 * getRootNode---window
		 * 			if(button is leaf) windwo.add(button)
		 * getChildern-----button toolbar
		 * 			if(toolbar is leaf) window.add(toolbar)
		 * 			else(
		 * 			   getChildern----button textfield
		 * 						if(button is leaf)
		 * 						if(textfield is leaf)
		 * 			)
		 * 
		 * 
		 * travlse(T){
		 * 		if(T is not leaf ){
		 * 			List list = T.getChildern();
		 * 			for(tt :list){travlse(tt)}
		 * 		}else{ 
		 * 			decorate(T)
		 * 			p =T.getParent; p.add(T)
		 * 		}
		 * }
		 * 
		 *//*
		*//**
		 * ��ȡ��ڵ�
		 * Ϊ��ڵ㴴������
		 * Ϊ��ڵ����ֵ
		 * ��ȡ�ӽڵ�
		 * Ϊ�ӽڵ㸳ֵ
		 * �������ӽڵ㣬�����ڵ�
		 *//*
		*//**
		 * ��α�����
		 * ��ȡ��ڵ�
		 * 
		 * �ѽڵ㣨��ʼΪ��ڵ㣩����list
		 * ȡ���˽ڵ�
		 * ��ô˽ڵ�������ӽڵ�
		 * ����Щ�ӽڵ㣬���η���list
		 * 
		 * �����㷨
		 * while(list.size()>0){
		 * 		x = list.get(0)); list.remove(0); list.add(x.getChildern)
		 * }
		 * �����ֲ�ͬ ��εĽڵ�-----------��ֲ�����ַ�ʽ����
		 * while(list.size()>0){
		 * 		x = list.get(0)); count =x.getChildernCount; list.add(x.getChildern);list.add(������);
		 * 		
		 * }
		  *//* 
		*//**
		 * ���������ϵ�����ڵ㡢�ӽڵ㣩-----------�����ֵܽ׶ε�rightValue��leftValue���1
		 * ������������ϵ
		 * eg��root[1,20]
		 * ��λ�ø�ڵ��ֱ���ӽڵ�
		 * 1+1=2
		 * ���leftValue=2�Ľڵ�
		 * ��øýڵ��rightValue��rightValue=10
		 * ��θ�rightValue<20
		 * ��ȡleftValue=11�Ľڵ�
		 * ��ȡ�ýڵ��rightValue=19
		 * ����rightValue+1<20����������ӽڵ�
		 * 
		 * 
		 * �����㷨
		 * ��ø�ڵ�root
		 * root.getChildern()????
		 * node = root.getChild   
		 * node2=node.getBrother(root);
		 * node3=node2.getBrother(root);...................
		 * if(node3.getBrother==null){
		 * 		node.getChild
		 * 		..............................
		 * }
		 * 
		 * �����㷨2
		 * ��ø�ڵ�root
		 * ����tempRoot ------tempRoot=root
		 * �������ֱ���ӽڵ�
		 * root.getChildern()
		 * �����ӽڵ����childrenList------childrenList.add(...)
		 * ��childrenList = ������?pathList��
		 * tempRoot = pathList.get(0); pathList.remove(0)
		 * ���tempRoot������ֱ���ӽڵ�
		 * 		.................
		 * travel(List){
		 * 	root = list.getRoot;
		 * 	
		 * }
		 * 
		 * �����㷨3
		 * �����������ķ�ʽ����Ƕ�׼��ϣ���leftValue��rightValue�����Ǹ��������������
		 * ��ȡ��ڵ�root------- ����ֱ�ӻ��
		 * �����һ��
		 * 
		 * 
		 *//*
		*//**
		 * �����㷨�봴���������
		 * while(list.size()>0){
		 * x = list.get(0));  
		 * list.remove(0);
		 * list.add(������);
		 * list.add(x.getChildern())
		 * if(������){
		 * tempRoot==null;
		 * list2.clear()
		 * }else{
		 * create(x) 
		 * 
		 * if(tempRoot==null)
		 * 		{tempRoot = x   }else{   list2.add(x);}
		 * 
		 * }
		 * 
		 * 
		 * }
		 * 
		 *//*
		//��ȡ��ڵ�
		GxtComponentMetaNodeModel root= gxtComponentMetaModel.getRoot();
		
		//Ϊ��ڵ㴴������
		//Ϊ��ڵ����ֵ
		//�Ѹ�ڵ����List
		List<GxtComponentMetaNodeModel> list = new ArrayList<GxtComponentMetaNodeModel>();
		//��ű���󣬴����Ŀؼ�
		Map<GxtComponentMetaNodeModel, COMPONENT> map = new HashMap<GxtComponentMetaNodeModel, COMPONENT>();
		list.add(root);
		GxtComponentMetaNodeModel temp;
		//��α������νṹ
		while(list.size()>0){
			  		temp = list.get(0); list.remove(0);
			  		map.put(temp, createBaseGxtComponent(temp));
			  		
			  		if (gxtComponentMetaModel.getParent(temp)!=null) {
			  			
						((LayoutContainer)map.get(gxtComponentMetaModel.getParent(temp))).add(map.get(temp, createBaseGxtComponent(temp)));
					}
			  		createBaseGxtComponent(temp);
			  		list.addAll(gxtComponentMetaModel.getChildren(temp));
		}
		gxtComponentMetaModel.getChildren(gxtComponentMetaNodeModel);
		*//**
		 * XxxFactory.createXxx(gxtComponentMetaNodeModel)
		 *//*
		for (GxtComponentMetaModel gxtComponentMetaNodeModel: gxtComponentMetaModelList) {
			
			ComponentTypeEnum componentTypeEnum = gxtComponentMetaNodeModel.getComponentTypeEnum();
			
			switch (componentTypeEnum) {
			//��һö�ٳ�ComponentTypeEnum�����еĿؼ�����
			case BUTTON_MODEL: {
				component = (COMPONENT) ButtonFactory.createButton(gxtComponentMetaNodeModel);
			}
			case GRID_MODEL: {
				component = (COMPONENT) GridFactory.createGrid(gxtComponentMetaNodeModel);
			}
			//����Ķ�������е�
			case WINDOW_MODEL: {
				//component = (COMPONENT) WindowFactory.buildButton(gxtComponentMetaNodeModel);
			}
			
			default: {//��componentTypeEnumΪ�գ����������пؼ����Ͳ����ʱ
				component = null;
				break;
			}
			}
			
			//componentList.add(component);
			map.put(gxtComponentMetaNodeModel, component);
		}
		
		
		
		return ;
		//�ڶ��Σ���ֵ
		return null;
	}
	
	private static  <COMPONENT extends Component> COMPONENT name(List<COMPONENT> componentList,List<GxtComponentMetaModel> gxtComponentMetaModelList) {
		
		return null;
	}
}*/
